﻿<UserControl x:Class="Group3.MediaTool.Data.DefinitionBuilder.DataDefinitionBuilder"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="443.662" d:DesignWidth="600">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="OverviewContentStyle" TargetType="{x:Type ListViewItem}">
                <EventSetter Event="Selected" Handler="OverviewItemClick"></EventSetter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Name="LayoutRoot" Background="{DynamicResource {x:Static SystemColors.AppWorkspaceBrushKey}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="20"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Menu IsMainMenu="True" >
                <MenuItem Height="20" Click="SaveButton_Click" Header="_Save">
                    <MenuItem.Icon>
                        <Image Source="Resources/icon_Save.png" Name="Save" />
                    </MenuItem.Icon>
                </MenuItem>
            </Menu>
        </Grid>
        <Grid Grid.Row="1">
        <Grid.RowDefinitions>
            <RowDefinition Height="1"/>
            <RowDefinition Height="42"/>
            <RowDefinition Height="67*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Name="ColOverview" Width="120"/>
            <ColumnDefinition Name="ColDetail" Width="400*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0" Grid.Row="1">
            <Button Click="AddClassButton_Click">Add Class</Button>
        </Grid>
        <Grid Grid.Column="0" Name="OverView" Grid.Row="2">
            <ListView Name="listOverview" Width="Auto" ItemContainerStyle="{StaticResource OverviewContentStyle}">
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="Class" Width="120"/>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>
        <Grid Grid.Column="1" Grid.Row="1" Name="Insert" Height="42" Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="400"/>

                <ColumnDefinition Width="60"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <WrapPanel Grid.Row="0" Grid.Column="0" >
                <TextBox Width="130" IsEnabled="False" >Attribute Name</TextBox>
                <TextBox Width="130" IsEnabled="False" >Attribute Datatype</TextBox>
                <TextBox Width="130" IsEnabled="False">Attribute Type</TextBox>
            </WrapPanel>
            <WrapPanel Grid.Row="1" Grid.Column="0">
                <TextBox Width="130" Name="tAttributeName"></TextBox>
                <ComboBox Width="130" Name="cbAttributeDatatype">
                    <ComboBoxItem Name="RefItem" Tag="" Selected="ReferenceItem_Selected">Reference</ComboBoxItem>
                    <ComboBoxItem Name="nvarchar" Tag="" Selected="nvarcharItem_Selected">nvarchar</ComboBoxItem>
                    <ComboBoxItem Name="nchar" Tag="" Selected="nvarcharItem_Selected">nchar</ComboBoxItem>
                    </ComboBox>
                <ComboBox Width="130" Name="cbAttributeType">
                    <ComboBoxItem Tag="0" Name="normalAttr">Simple Attribute</ComboBoxItem>
                    <!--<ComboBoxItem Tag="1">With Primary key</ComboBoxItem>-->
                    <ComboBoxItem Tag="2">Not null with index</ComboBoxItem>
                    <ComboBoxItem Tag="3">Not null</ComboBoxItem>
                    <ComboBoxItem Tag="4">Column with index</ComboBoxItem>
                    <ComboBoxItem Name="classRef" Tag="5">Reference to class</ComboBoxItem>
                </ComboBox>
            </WrapPanel>
            <Button Grid.Column="1" Grid.RowSpan="2" Click="AddLineButton_Click" >Add</Button>
            <!--<Button Grid.Column="2" Grid.RowSpan="2" Click="SaveButton_Click">Save All</Button>-->
        </Grid>
        <Grid Grid.Column="1" Name="Details" Grid.Row="2" Grid.ColumnSpan="3">
            <DataGrid Name="listDetail" ItemsSource="{Binding}" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Activity" Width="Auto" Binding="{Binding Activity}"/>
                    <DataGridTextColumn Header="Attributename" Width="Auto" Binding="{Binding AttributeName}"/>
                    <DataGridTextColumn Header="Attribute Datatype" Width="Auto" Binding="{Binding AttributeDataType}"/>
                    <DataGridTextColumn Header="Attribute Type" Width="Auto" Binding="{Binding AttributeType}"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
        </Grid>
    </Grid>
</UserControl>
